

import { createSelector } from '@ngrx/store';

import { getMapState } from './map.selector';
import { MapState, DataTableState } from '../reducers';
import { DataTable } from '../../models';

const getDataTableState = createSelector(getMapState, (state: MapState) => state.dataTable);
const getDataTableEntities = createSelector(getDataTableState, (state: DataTableState) => state.entities);
const getDataTableVisible = createSelector(getDataTableState, (state: DataTableState) => state.visible);
const getDataTableLastAdd = createSelector(getDataTableState, (state: DataTableState) => state.lastAdd);
const getDataTableLastRemove = createSelector(getDataTableState, (state: DataTableState) => state.lastRemove);
const getDataTableSelectedIndex = createSelector(getDataTableState, (state: DataTableState) => state.selectedIndex);
const getDataTableMouseOver = createSelector(getDataTableState, (state: DataTableState) => state.mouseOver);
const getDataTableMouseOut = createSelector(getDataTableState, (state: DataTableState) => state.mouseOut);

export const dataTableSelector = {
    getDataTableState,
    getDataTableEntities,
    getDataTableVisible,
    getDataTableLastAdd,
    getDataTableLastRemove,
    getDataTableSelectedIndex,
    getDataTableMouseOver,
    getDataTableMouseOut
}